A typical processing system may utilize an external memory for data storage. For example, such a system may be implemented as a system on a chip (SOC) which comprises a processor that accesses both on-chip and off-chip memory. Secure computation can be achieved if the software is secure and the associated instructions and data remain entirely on-chip and are not exposed to external view. But once data is transferred off-chip, it becomes vulnerable to attack and the security of a given computation may be compromised. For example, an adversary could obtain access to an unprotected off-chip memory and examine the stored data, possibly detecting secret information. The adversary could even modify the stored data and thereby subvert an otherwise secure computation.
These security issues are generally addressed by encrypting data prior to its storage in an off-chip memory or other external memory of a processing system. However, encryption alone may provide insufficient protection against a determined adversary. For example, such an adversary could modify the encrypted data, and the modified encrypted data could later be retrieved by the processor, decrypted and accepted as valid.
It is well known that storage of a digital signature can allow detection of this type of tampering with encrypted data. The signature is an example of what is more generally referred to herein as a message authentication code (MAC). A MAC is generated from the encrypted data prior to storage, and upon retrieval of the encrypted data, another MAC is generated from the retrieved encrypted data and compared with the original MAC. If the encrypted data has been modified while stored in the external memory, the second MAC will not agree with the first, and the processor can determine whether to accept or reject the retrieved encrypted data based on such a determination.
A problem that arises in conventional processing systems that store encrypted data relates to storage of the original MAC generated for the encrypted data. A typical approach is to store the MAC separately from the corresponding encrypted data. However, such an approach is inefficient in that multiple accesses to the external memory are generally required in order to retrieve both the encrypted data and its associated MAC from the external memory, even if the encrypted data itself comprises only a relatively small block of data that could otherwise be easily retrieved in a single access to external memory.